; (function () {
    function init() {

    }
    $('.tab-menuConti li').click(function () {
        $(this).addClass('active').siblings().removeClass('active');
        if ($(this).index() != 0) {
            $('.introduce').css('display', "none")
        }
        if ($(this).index() == 0) {

        } else {
            $('.background-img').eq($(this).index() - 1).css('display', 'block').siblings().css('display', 'none')
        }
    })

    var XiangShu = function (id) {
        console.log(id);
        var ajax;
        if (window.XMLHttpRequest) {
            ajax = new XMLHttpRequest();
        } else {
            ajax = new ActiveXObject(Microsoft.XMLHttp);
        }
        ajax.open('get', 'http://192.168.0.149/tp5/public/index.php/index/classall?pageCurrent=1&pageSize=10&id='+id*1);
        // ajax.open('get', 'http://localhost/api.php/yuzhiyuan/teachers?transform=1&order=id&page=1,5');
        ajax.send();
        ajax.onreadystatechange = function () {
            if (ajax.readyState == 4 && ajax.status == 200) {
                // renderAllClass(JSON.parse(ajax.responseText).data.list);
                // renderAllClass();
                // ArrAllClass = JSON.parse(ajax.responseText).data.list;
                // getAllClassFenLei();
                console.log(JSON.parse(ajax.responseText).data.list);
                RENderXiang(JSON.parse(ajax.responseText).data.list)
            }
        }
    }

    function RENderXiang(a) {
        console.log(a);
        // console.log(arrone);
        $('.topconL-n').css('background', 'url(' + a[0].img + ' no-repeat center)')
        $('.codezhi').text(a[0].title)
        $('.monred').text('￥'+a[0].price)
        $('.monlast').text('￥'+a[0].price_old)

    }

    window.onload=function(a){
        // console.log(location.href);
        var url=location.href;
        var urls=url.split('?');
        var ids=urls[1].split('=');
        var id=ids[1];
        XiangShu(id)
    }

    
    init()
})()